import request from "@/utils/request";

export class tkTaskCaseApi {
  static getPageList(params) {
    return request({
      url: "/tk/task/case/page/list",
      method: "get",
      params: params,
    });
  }
  //#- 添加
  static add(data) {
    return request({
      url: "/tk/task/case/add",
      method: "post",
      data: data,
    });
  }
  static getInfoById(id) {
    return request({
      url: `/tk/task/case/${id}`,
      method: "get",
    });
  }

  static edit(data) {
    return request({
      url: "/tk/task/case/edit",
      method: "put",
      data: data,
    });
  }

  static remove(ids) {
    return request({
      url: `/tk/task/case/bathRemove/${ids}`,
      method: "delete",
    });
  }
  //# =====================================用例详情=======
  //# 用例详情
  static getCaseInfoList(caseId) {
    return request({
      url: `/tk/task/case/info/list/${caseId}`,
      method: "get",
    });
  }
  //# 修改某一条用例
  static editCaseInfo(data) {
    return request({
      url: `/tk/task/case/info/edit`,
      method: "put",
      data: data,
    });
  }

  //# 删除某一条用例
  static infoRemove(ids) {
    return request({
      url: `/tk/task/case/info/remove/${ids}`,
      method: "delete",
    });
  }

  //# ==============================【测试结果】=======================
  //# 结果列表
  static getCaseResultList(rid) {
    return request({
      url: `/tk/case/result/list/${rid}`,
      method: "get",
    });
  }
  //# 测试结果下拉选项
  static getCaseResultNameList(caseId) {
    return request({
      url: `/tk/case/result/getCaseResultName/${caseId}`,
      method: "get",
    });
  }
  //# 删除测试结果
  static removeCaseResult(caseId) {
    return request({
      url: `/tk/case/result/remove/${caseId}`,
      method: "delete",
    });
  }

  //# ================================【开始执行测试用例】==================
  static caseExecuteStart(params) {
    return request({
      url: `/tk/task/case/execute/add`,
      method: "get",
      params: params,
    });
  }

  //# 实时查询结果列表
  static getExecuteList() {
    return request({
      url: `/tk/task/case/getExecuteList`,
      method: "get",
    });
  }

  //# 用例是否执行完成
  static getExecuteResultIsFinish(caseId) {
    return request({
      url: `/tk/task/case/getExecuteResultIsFinish/${caseId}`,
      method: "get",
    });
  }
}
